The present invention relates generally to the field of optimizing memory usage, and more specifically, to optimizing memory usage and startup performance by refactoring object oriented program code and reducing the number of classes in an application with an optimizer tool.
An object oriented application may consist of classes, each of which may contain methods (or functional members, or functions) that may contain the instructions to run the program. Classes may also contain data members (fields). Classes may be “instantiated” in order to create objects. Each object may contain its own set of data as specified by the data members of the class, and the functional members of any given object may be capable of acting on the data members of the object.
Some languages may allow for the “throwing” of objects in which the execution stack of invoked methods may be unwound due to an exceptional condition, until code that is capable of handling the exceptional condition is located. These objects are instances of exception classes. Generally the exception classes are organized in class hierarchy with each subclass expressing an exception type. In most cases these subclasses do not provide additional methods or fields, which means their type is the only information these classes provide.
On some platforms, particularly embedded and mobile device platforms, memory usage must be kept to a minimum. Small differences in memory requirements may result in sizable savings relative to the cost of the device. Removing unneeded exception classes can reduce memory usage.
Hence, there is a need for a more efficient system and method for removing exception classes.